<@page.html title="菜单设置">
<script type="text/javascript" src="${_appPath!}/js/dtree.js"></script>
<script type="text/javascript">
  function add() {
    if(!_lsid) {
      window.alert("请选择");
      return;
    }
    open2("add?pid="+_lsid);
  }
  var tree = null;
  function query() {
    getJson("_list", function(data){
      if(data.ret) {
        tree = new dTree("tree", "${_appPath!}/");
        tree.config.closeSameLevel = false;
        for(var i=0; i<data.data.length; i++) {
          var menu = data.data[i];
          tree.add(menu.id, menu.pid, menu.name, "javascript:view('"+menu.id+"')", "", "", "", "", true);
        }
        getEl("div_tree").innerHTML = tree;
      }
    });
  }
  function reloadlist() {
    query();
  }

  var _lsid = null;
  function view(id) {
    _lsid = id;
    if(id) open2("edit?menuId="+id);
  }
</script>
<div id="div_main"></div>
<div style="float:left; width:340px;">
  <div class="search">
    <dl>
      <dt>菜单设置</dt>
      <dd class="oper"><#if canAdd??><a class="add" href="javascript:add();">新增</a></#if></dd>
    </dl>
  </div>
  <div id="div_list"><div id="div_tree" class="navTree" style="height:450px; overflow:auto; margin-top:10px;"></div></div>
</div>
<div id="div_edit" style="display:none; float:left; margin-left:20px; width:450px;"></div>
<script type="text/javascript">query();</script>
</@page.html>